package dao.auth.mybatis;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import model.auth.Resources;

import org.springframework.stereotype.Repository;

import core.base.page.Page;
import core.base.page.PageRequest;
import dao.MyBatisBaseDao;
import dao.auth.ResourcesDao;

@Repository("auth.ResourcesDao")
public class ResourcesDaoImpl extends MyBatisBaseDao implements ResourcesDao {

	public int deleteById(Long id) {
		return getSqlSessionTemplate().delete("auth.ResourcesMapper.deleteById", id);
	}

	public int deleteBatch(Long[] list) {
		Map data = new HashMap();
		data.put("list", list);
		return getSqlSessionTemplate().delete("auth.ResourcesMapper.deleteBatch", data);
	}

	public Resources getById(Long id) {
		return (Resources) getSqlSessionTemplate().selectOne("auth.ResourcesMapper.getById", id);
	}

	public int insert(Resources model) {
		return getSqlSessionTemplate().insert("auth.ResourcesMapper.insert", model);
	}

	public List<Resources> queryByProperties(Map filter) {
		return getSqlSessionTemplate().selectList("auth.ResourcesMapper.queryByProperties", filter);
	}

	public Page<Resources> queryForPage(PageRequest<Map> pageReq) {
		return super.queryForPage(pageReq, "auth.ResourcesMapper.queryForPage");
	}

}
